//
//  NSAttributedStringExtensions.swift
//  DemoNavBar
//
//  Created by YangHuan on 2019/12/16.
//  Copyright © 2019 YangHuan. All rights reserved.
//

import Foundation
import UIKit

public extension NSAttributedString {
    
    func changeFontColor(totalString: String, subString: String, font: UIFont , textColor: UIColor) -> NSMutableAttributedString {
        let attStr = NSMutableAttributedString.init(string: totalString)
         attStr.addAttributes([NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.font: font], range: NSRange.init(location: totalString.count-subString.count, length: subString.count))
        return attStr
    }
    
    
    
}
